//
// Created by 17775 on 2024/7/15.
//

#include "TimeM.h"

void TimeM::start() {
    if (!isRunning) {
        timer.start();
        isRunning = true;
    }
}

void TimeM::stop() {
    if (isRunning) {
        elapsedTime += timer.elapsed();
        isRunning = false;
    }
}

void TimeM::reset() {
    elapsedTime = 0;
    isRunning = false;
}

double TimeM::time() const {
    return isRunning ? timer.elapsed() + elapsedTime : elapsedTime;
}

